<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>


var majorityElement = function(nums) {
    debugger;
    // 用map
    var m = new Map()
    nums.forEach(item=>{
        if(m.has(item)){
            var val = m.get(item)
            m.set(item,val+1)
        }else {
            m.set(item,1)
        }
    })
   
    var arr = [...m.values()];
    

    // console.log(arr.toString())
};

majorityElement([2,3,3])

    </script>
</body>
</html>